package cn.puge.mertisfront.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author: LiJW-
 * @date: 2020/6/7 21:07
 * 文件说明：
 */

@Component
//@PropertySource("classpath:application.yml")
public class ConstantPropertiesUtil implements InitializingBean {

    @Value("${puge.open.app_id}")
    private String appId;

    @Value("${puge.open.app_key}")
    private String appKEY;

    @Value("${puge.open.redirect_url}")
    private String redirectUrl;
    @Value("${puge.open.pugeredirect_url}")
    private String pugeRedirectUrl;

    public static String QQ_OPEN_APP_ID;
    public static String QQ_OPEN_APP_KEY;
    public static String QQ_OPEN_REDIRECT_URL;
    public static String Puge_OPEN_REDIRECT_URL;


    /**
     * spring加载之后执行此方法，把值赋到公开静态常量
     * @throws Exception
     */
    @Override
    public void afterPropertiesSet() throws Exception {
        QQ_OPEN_APP_ID = appId;
        QQ_OPEN_APP_KEY = appKEY;
        QQ_OPEN_REDIRECT_URL = redirectUrl;
        Puge_OPEN_REDIRECT_URL = pugeRedirectUrl;
    }
}